﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using ContactTracing.Core;

namespace ContactTracing.ViewModel
{
    public class LabResultViewModel : ObservableObject
    {
        #region Members
        private LabResult _labResult;
        private CaseViewModel _caseViewModel;
        private string _gender = String.Empty;
        private double? _age = null;
        #endregion // Members

        #region Properties
        public string Gender
        {
            get
            {
                return this._gender;
            }
            set
            {
                if (!Gender.Equals(value))
                {
                    this._gender = value;
                    RaisePropertyChanged("Gender");
                }
            }
        }

        public double? Age
        {
            get
            {
                return this._age;
            }
            set
            {
                if (!Age.Equals(value))
                {
                    this._age = value;
                    RaisePropertyChanged("Age");
                }
            }
        }
        private LabResult LabResult 
        { 
            get 
            { 
                return this._labResult; 
            } 
        }
        public CaseViewModel CaseVM
        {
            get
            {
                return this._caseViewModel;
            }
            set
            {
                this._caseViewModel = value;
            }
        }
        public string Surname 
        { 
            get 
            { 
                return LabResult.Surname; 
            } 
            set 
            { 
                if (LabResult.Surname != value) 
                { 
                    LabResult.Surname = value; RaisePropertyChanged("Surname"); 
                } 
            }
        }

        public string RecordId { get { return LabResult.RecordId; } set { if (LabResult.RecordId != value) { LabResult.RecordId = value; RaisePropertyChanged("RecordId"); } } }
        public string OtherNames { get { return LabResult.OtherNames; } set { if (LabResult.OtherNames != value) { LabResult.OtherNames = value; RaisePropertyChanged("OtherNames"); } } }
        public string CaseID { get { return LabResult.CaseID; } set { if (LabResult.CaseID != value) { LabResult.CaseID = value; RaisePropertyChanged("CaseID"); } } }
        public string LabCaseID { get { return LabResult.LabCaseID; } set { if (LabResult.LabCaseID != value) { LabResult.LabCaseID = value; RaisePropertyChanged("LabCaseID"); } } }
        public string CaseRecordGuid { get { return LabResult.CaseRecordGuid; } set { if (LabResult.CaseRecordGuid != value) { LabResult.CaseRecordGuid = value; RaisePropertyChanged("CaseRecordGuid"); } } }
        public int ResultNumber { get { return LabResult.ResultNumber; } set { if (LabResult.ResultNumber != value) { LabResult.ResultNumber = value; RaisePropertyChanged("ResultNumber"); } } }

        public string FieldLabSpecimenID { get { return LabResult.FieldLabSpecimenID; } set { if (LabResult.FieldLabSpecimenID != value) { LabResult.FieldLabSpecimenID = value; RaisePropertyChanged("FieldLabSpecimenID"); } } }
        public string UVRIVSPBLogNumber { get { return LabResult.UVRIVSPBLogNumber; } set { if (LabResult.UVRIVSPBLogNumber != value) { LabResult.UVRIVSPBLogNumber = value; RaisePropertyChanged("UVRIVSPBLogNumber"); } } }
        public string Village { get { return LabResult.Village; } set { if (LabResult.Village != value) { LabResult.Village = value; RaisePropertyChanged("Village"); } } }
        public string District { get { return LabResult.District; } set { if (LabResult.District != value) { LabResult.District = value; RaisePropertyChanged("District"); } } }
        public string SampleType { get { return LabResult.SampleType; } set { if (LabResult.SampleType != value) { LabResult.SampleType = value; RaisePropertyChanged("SampleType"); } } }
        public DateTime? DateOnset { get { return LabResult.DateOnset; } set { if (LabResult.DateOnset != value) { LabResult.DateOnset = value; RaisePropertyChanged("DateOnset"); } } }
        public DateTime? DateSampleCollected { get { return LabResult.DateSampleCollected; } set { if (LabResult.DateSampleCollected != value) { LabResult.DateSampleCollected = value; RaisePropertyChanged("DateSampleCollected"); } } }
        public DateTime? DateSampleTested { get { return LabResult.DateSampleTested; } set { if (LabResult.DateSampleTested != value) { LabResult.DateSampleTested = value; RaisePropertyChanged("DateSampleTested"); } } }
        public DateTime? DateDeath { get { return LabResult.DateDeath; } set { if (LabResult.DateDeath != value) { LabResult.DateDeath = value; RaisePropertyChanged("DateDeath"); } } }
        public int? DaysAcute { get { return LabResult.DaysAcute; } set { if (LabResult.DaysAcute != value) { LabResult.DaysAcute = value; RaisePropertyChanged("DaysAcute"); } } }
        public string FinalLabClassification { get { return LabResult.FinalLabClassification; } set { if (LabResult.FinalLabClassification != value) { LabResult.FinalLabClassification = value; RaisePropertyChanged("FinalLabClassification"); } } }
        public string SampleInterpretation { get { return LabResult.SampleInterpretation; } set { if (LabResult.SampleInterpretation != value) { LabResult.SampleInterpretation = value; RaisePropertyChanged("SampleInterpretation"); } } }
        public string MalariaRapidTest { get { return LabResult.MalariaRapidTest; } set { if (LabResult.MalariaRapidTest != value) { LabResult.MalariaRapidTest = value; RaisePropertyChanged("MalariaRapidTest"); } } }
        public int UniqueKey { get { return LabResult.UniqueKey; } set { if (LabResult.UniqueKey != value) { LabResult.UniqueKey = value; RaisePropertyChanged("UniqueKey"); } } }

        public string SUDVPCR { get { return LabResult.SUDVPCR; } set { if (LabResult.SUDVPCR != value) { LabResult.SUDVPCR = value; RaisePropertyChanged("SUDVPCR"); } } }
        public string SUDVPCR2 { get { return LabResult.SUDVPCR2; } set { if (LabResult.SUDVPCR2 != value) { LabResult.SUDVPCR2 = value; RaisePropertyChanged("SUDVPCR2"); } } }
        public string SUDVAg { get { return LabResult.SUDVAg; } set { if (LabResult.SUDVAg != value) { LabResult.SUDVAg = value; RaisePropertyChanged("SUDVAg"); } } }
        public string SUDVIgM { get { return LabResult.SUDVIgM; } set { if (LabResult.SUDVIgM != value) { LabResult.SUDVIgM = value; RaisePropertyChanged("SUDVIgM"); } } }
        public string SUDVIgG { get { return LabResult.SUDVIgG; } set { if (LabResult.SUDVIgG != value) { LabResult.SUDVIgG = value; RaisePropertyChanged("SUDVIgG"); } } }

        public string BDBVPCR { get { return LabResult.BDBVPCR; } set { if (LabResult.BDBVPCR != value) { LabResult.BDBVPCR = value; RaisePropertyChanged("BDBVPCR"); } } }
        public string BDBVPCR2 { get { return LabResult.BDBVPCR2; } set { if (LabResult.BDBVPCR2 != value) { LabResult.BDBVPCR2 = value; RaisePropertyChanged("BDBVPCR2"); } } }
        public string BDBVAg { get { return LabResult.BDBVAg; } set { if (LabResult.BDBVAg != value) { LabResult.BDBVAg = value; RaisePropertyChanged("BDBVAg"); } } }
        public string BDBVIgM { get { return LabResult.BDBVIgM; } set { if (LabResult.BDBVIgM != value) { LabResult.BDBVIgM = value; RaisePropertyChanged("BDBVIgM"); } } }
        public string BDBVIgG { get { return LabResult.BDBVIgG; } set { if (LabResult.BDBVIgG != value) { LabResult.BDBVIgG = value; RaisePropertyChanged("BDBVIgG"); } } }

        public string EBOVPCR { get { return LabResult.EBOVPCR; } set { if (LabResult.EBOVPCR != value) { LabResult.EBOVPCR = value; RaisePropertyChanged("EBOVPCR"); } } }
        public string EBOVPCR2 { get { return LabResult.EBOVPCR2; } set { if (LabResult.EBOVPCR2 != value) { LabResult.EBOVPCR2 = value; RaisePropertyChanged("EBOVPCR2"); } } }
        public string EBOVAg { get { return LabResult.EBOVAg; } set { if (LabResult.EBOVAg != value) { LabResult.EBOVAg = value; RaisePropertyChanged("EBOVAg"); } } }
        public string EBOVIgM { get { return LabResult.EBOVIgM; } set { if (LabResult.EBOVIgM != value) { LabResult.EBOVIgM = value; RaisePropertyChanged("EBOVIgM"); } } }
        public string EBOVIgG { get { return LabResult.EBOVIgG; } set { if (LabResult.EBOVIgG != value) { LabResult.EBOVIgG = value; RaisePropertyChanged("EBOVIgG"); } } }

        public string MARVPCR { get { return LabResult.MARVPCR; } set { if (LabResult.MARVPCR != value) { LabResult.MARVPCR = value; RaisePropertyChanged("MARVPCR"); } } }
        public string MARVPCR2 { get { return LabResult.MARVPCR2; } set { if (LabResult.MARVPCR2 != value) { LabResult.MARVPCR2 = value; RaisePropertyChanged("MARVPCR2"); } } }
        public string MARVAg { get { return LabResult.MARVAg; } set { if (LabResult.MARVAg != value) { LabResult.MARVAg = value; RaisePropertyChanged("MARVAg"); } } }
        public string MARVIgM { get { return LabResult.MARVIgM; } set { if (LabResult.MARVIgM != value) { LabResult.MARVIgM = value; RaisePropertyChanged("MARVIgM"); } } }
        public string MARVIgG { get { return LabResult.MARVIgG; } set { if (LabResult.MARVIgG != value) { LabResult.MARVIgG = value; RaisePropertyChanged("MARVIgG"); } } }

        public string CCHFPCR { get { return LabResult.CCHFPCR; } set { if (LabResult.CCHFPCR != value) { LabResult.CCHFPCR = value; RaisePropertyChanged("CCHFPCR"); } } }
        public string CCHFPCR2 { get { return LabResult.CCHFPCR2; } set { if (LabResult.CCHFPCR2 != value) { LabResult.CCHFPCR2 = value; RaisePropertyChanged("CCHFPCR2"); } } }
        public string CCHFAg { get { return LabResult.CCHFAg; } set { if (LabResult.CCHFAg != value) { LabResult.CCHFAg = value; RaisePropertyChanged("CCHFAg"); } } }
        public string CCHFIgM { get { return LabResult.CCHFIgM; } set { if (LabResult.CCHFIgM != value) { LabResult.CCHFIgM = value; RaisePropertyChanged("CCHFIgM"); } } }
        public string CCHFIgG { get { return LabResult.CCHFIgG; } set { if (LabResult.CCHFIgG != value) { LabResult.CCHFIgG = value; RaisePropertyChanged("CCHFIgG"); } } }

        public string RVFPCR { get { return LabResult.RVFPCR; } set { if (LabResult.RVFPCR != value) { LabResult.RVFPCR = value; RaisePropertyChanged("RVFPCR"); } } }
        public string RVFPCR2 { get { return LabResult.RVFPCR2; } set { if (LabResult.RVFPCR2 != value) { LabResult.RVFPCR2 = value; RaisePropertyChanged("RVFPCR2"); } } }
        public string RVFAg { get { return LabResult.RVFAg; } set { if (LabResult.RVFAg != value) { LabResult.RVFAg = value; RaisePropertyChanged("RVFAg"); } } }
        public string RVFIgM { get { return LabResult.RVFIgM; } set { if (LabResult.RVFIgM != value) { LabResult.RVFIgM = value; RaisePropertyChanged("RVFIgM"); } } }
        public string RVFIgG { get { return LabResult.RVFIgG; } set { if (LabResult.RVFIgG != value) { LabResult.RVFIgG = value; RaisePropertyChanged("RVFIgG"); } } }

        public string LHFPCR { get { return LabResult.LHFPCR; } set { if (LabResult.LHFPCR != value) { LabResult.LHFPCR = value; RaisePropertyChanged("LHFPCR"); } } }
        public string LHFPCR2 { get { return LabResult.LHFPCR2; } set { if (LabResult.LHFPCR2 != value) { LabResult.LHFPCR2 = value; RaisePropertyChanged("LHFPCR2"); } } }
        public string LHFAg { get { return LabResult.LHFAg; } set { if (LabResult.LHFAg != value) { LabResult.LHFAg = value; RaisePropertyChanged("LHFAg"); } } }
        public string LHFIgM { get { return LabResult.LHFIgM; } set { if (LabResult.LHFIgM != value) { LabResult.LHFIgM = value; RaisePropertyChanged("LHFIgM"); } } }
        public string LHFIgG { get { return LabResult.LHFIgG; } set { if (LabResult.LHFIgG != value) { LabResult.LHFIgG = value; RaisePropertyChanged("LHFIgG"); } } }
        #endregion // Properties

        #region Constructors
        public LabResultViewModel()
        {
            _labResult = new LabResult();
        }

        public LabResultViewModel(LabResult labResult)
        {
            _labResult = labResult;
        }
        #endregion // Constructors

        public void UpdateResult(LabResultViewModel updatedResult)
        {
            this.RecordId = updatedResult.RecordId;
            this.OtherNames = updatedResult.OtherNames;
            this.CaseID = updatedResult.CaseID;
            this.LabCaseID = updatedResult.LabCaseID;
            this.CaseRecordGuid = updatedResult.CaseRecordGuid;
            this.FieldLabSpecimenID = updatedResult.FieldLabSpecimenID;
            this.UVRIVSPBLogNumber = updatedResult.UVRIVSPBLogNumber;
            this.Village = updatedResult.Village;
            this.District = updatedResult.District;
            this.SampleType = updatedResult.SampleType;
            this.DateOnset = updatedResult.DateOnset;
            this.DateSampleCollected = updatedResult.DateSampleCollected;
            this.DateSampleTested = updatedResult.DateSampleTested;
            this.DateDeath = updatedResult.DateDeath;
            this.DaysAcute = updatedResult.DaysAcute;
            this.FinalLabClassification = updatedResult.FinalLabClassification;
            this.SampleInterpretation = updatedResult.SampleInterpretation;
            this.UniqueKey = updatedResult.UniqueKey;

            this.SUDVPCR = updatedResult.SUDVPCR;
            this.SUDVPCR2 = updatedResult.SUDVPCR2;
            this.SUDVAg = updatedResult.SUDVAg;
            this.SUDVIgM = updatedResult.SUDVIgM;
            this.SUDVIgG = updatedResult.SUDVIgG;

            this.BDBVPCR = updatedResult.BDBVPCR;
            this.BDBVPCR2 = updatedResult.BDBVPCR2;
            this.BDBVAg = updatedResult.BDBVAg;
            this.BDBVIgM = updatedResult.BDBVIgM;
            this.BDBVIgG = updatedResult.BDBVIgG;

            this.EBOVPCR = updatedResult.EBOVPCR;
            this.EBOVPCR2 = updatedResult.EBOVPCR2;
            this.EBOVAg = updatedResult.EBOVAg;
            this.EBOVIgM = updatedResult.EBOVIgM;
            this.EBOVIgG = updatedResult.EBOVIgG;

            this.MARVPCR = updatedResult.MARVPCR;
            this.MARVPCR2 = updatedResult.MARVPCR2;
            this.MARVAg = updatedResult.MARVAg;
            this.MARVIgM = updatedResult.MARVIgM;
            this.MARVIgG = updatedResult.MARVIgG;

            this.CCHFPCR = updatedResult.CCHFPCR;
            this.CCHFPCR2 = updatedResult.CCHFPCR2;
            this.CCHFAg = updatedResult.CCHFAg;
            this.CCHFIgM = updatedResult.CCHFIgM;
            this.CCHFIgG = updatedResult.CCHFIgG;

            this.RVFPCR = updatedResult.RVFPCR;
            this.RVFPCR2 = updatedResult.RVFPCR2;
            this.RVFAg = updatedResult.RVFAg;
            this.RVFIgM = updatedResult.RVFIgM;
            this.RVFIgG = updatedResult.RVFIgG;

            this.LHFPCR = updatedResult.LHFPCR;
            this.LHFPCR2 = updatedResult.LHFPCR2;
            this.LHFAg = updatedResult.LHFAg;
            this.LHFIgM = updatedResult.LHFIgM;
            this.LHFIgG = updatedResult.LHFIgG;
        }

        #region Commands
        void UpdateExecute(LabResultViewModel updatedResult)
        {
            UpdateResult(updatedResult);
        }

        public ICommand Update { get { return new RelayCommand<LabResultViewModel>(UpdateExecute); } }
        #endregion
    }
}
